Digital sorter and ranker

ABSTRACT

A digital sorter and ranker in which pairs of binary words are subtracted from each other in adders by feed-in in one word of the pair together with the adjacent word one&#39;&#39;s complement. A carry output indicates which word is the lowest and this output is fed through coincidence logic circuits to additional series of address and logic circuits in pyramid fashion until a single output is obtained from a final adder. The adder logic circuits, the carry output and the output of the final adder are fed through minimum value logic circuits to a series of minimum value flip-flops with the outputs thereof being fed back to the adders and their logic circuits. To record the rank of each word, a series of flip-flop groups with each group corresponding to a binary word is set according to the word&#39;&#39;s rank, the flip-flops being controlled by gating circuits fed by preceding logic circuits, the final adder, and a binary counter.

O United States Patent m1 m1 3,740,538

Hemphill 1 June 19, 1973 i 1 DIGITAL SORTER AND RANKER [57] ABSTRACT [75] inventor: Julie A. Hemphill, Los Altos, Calif, A digital sorter and ranker in which pairs of binary words are subtracted from each other in adders by [73l Assignec. The Ulllled staes 0f Amen as feed-in in one word of the pair together with the adjarePresemed by the Secremry of the cent word ones complement. A carry output indicates Force which word is the lowest and this output is fed through [22] Filed. July 28 1971 coincidence logic circuits to additional series of ad' dress and logic circuits in pyramid fashion until a single PP'- 165,898 output is obtained from a final adder The adder logic circuits, the carry output and the output of the final IJ-S' H 5 adder are fed through minimum value IOglC Cll'CLlitS IO 511 Im. Cl .7006: 7/06, oosr 7/60 a series minimum with {58] Field of Search 235/177; 340/1725, ""F beir'g fed back adders 340]]46 2 cults. To record the rank of each word, a series of flip- I flop groups with each group corresponding to a binary [56] References Cited word is set according to the word's rank, the flip-flops being controlled by gating circuits fed by preceding UNITED STATES PATENTS logic circuits, the final adder, and a binary counterv 3,428,946 2/1969 Batcher 340/1462 3,418,632 12/1968 Batcher v 340M462 3,034,l02 S/l962 Armstrong et a]... 23S/l77 X 3,104,376 9/1963 Nadler 340/1462 X 3,015.08) l2/l96l Armstrong 340M725 Primary Examiner-Malcolm A. Morrison Assistant Examiner-James F. Gottman Auorney- Harry A. Herbert, Jr. and Julian L. Siegel 2 Claims, 10 Drawing Figures END Patented June 19, 1973 10 Sheets-$119M. 1

HRWQQQ mkbQQ fimrml l Patented June 19, 1973 10 Shoots-Shut L LOG IC DUPLICITID IF'IELZc Mmmumsma) MI M; M; My M, M M754 i. W; 31'; H

INVENTOR.

JULIE Q. HEMPH/LL Patented June 19, 1973 3,740,538

10 Shanta-Shut CLocK Pm.

INV J LIE A. Hzmm u.

' BY Q Tam 4%] Patented June 19, 1973 3,740,538

10 Shuts-Shunt 6 uszr PULSE INVENTOR,

, 2e JULIE mg/mm Patented June 19, 1973 10 Shoots-Shut 7 INVENTOR. HEW/I114 Q u Patented June 19, 1973 10 Shoots-Sheet 8 FILE/ BY .4 r

Patented June 19, 1973 3,740,538

10 Shoo ts-Sheot 9 "I'm We INVENTOR. Juus n. HEMPmu.

T RME J Patented June 19, 1973 10 Sheets-Sheet 1O W E LM H AIT FA A 229200 qkh AU750I SAP/3G? write .PQ

INVENTOR. JUL IE 5! HEMPH/LL DIGITAL SORTER AND RANKER BACKGROUND OF THE INVENTION This invention relates to computer logic systems, and more particularly to ranking and sorting a set of binary codes. The usual method of performing a sorting or ranking operation on digital numbers is to use a general purpose digital computer. Unfortunately, the construction of general purpose computers is such that sorting or ranking these operations requires a computation time that is excessive or is not economical for some ap plications, particularly applications involving real time decisions and/or on-line control.

Various algorithms may be used to sort a set of numbers or to determine a rank with a general purpose digital computer. Speed will vary depending upon the number of words, word size, and computer capabilities.

This invention is most advantageously employed when the number of words is relatively small (less than or equal to 32).

The number of computer instructions required to find the K" rank out of N words is approximately: (three instructions) X (N words)X(K). The number of instructions required for a complete sort of N words is approximately: (three instructlons) (N words)X(N). Assuming an average of two computer cycles per operation and a computer cycle time of one microsecond, to find the fifth rank of l6 words requires about 240 microseconds. For a complete sort of 16 words, about lh milliseconds is required.

SUMMARY OF THE INVENTION The purpose of this invention is to provide a rapid means for ranking a set of N unordered binary numbers. Part of the logic may be eliminated to provide a rapid means for finding the K" ranking member of a set of numbers.

For purposes of the description, it is assumed that there are 16 words of 8 bits per word. The design uses adders to rank the 16 words. For a complete sort of the 16 numbers, operating time is about 8 microseconds. Finding the fifth rank of a set of 16 numbers requires about 3 microseconds.

This device can be used as a peripheral element of a general purpose computer analysis, decision, or control configuration. It has particular application in real time processing when speed is critical.

It is therefore an object of this invention to provide a novel and improved system for sorting a series of binary words and determining the rank of each word.

It is another object to provide a digital ranking and sorting system having a greater speed than that used in the past.

It is still another object to provide a digital ranking and sorting system that provides real time processing and can be used in computer analysis, decision and control configurations.

These and other advantages, features and objects of the invention will become more apparent from the following description taken in connection with the illustrative embodiment in the accompanying drawings.

DESCRIPTION OF THE DRAWINGS FIG. I shows the logic flow diagram used in the explanation of the invention;

FIGS. 2a through 2e are block diagrams of an embodiment of the invention;

FIGS. 3, 4, and 5 are details of that shown in FIGS. 2a through 2e further describing the logic blocks;

FIG. 6 is a timing diagram showing the maximum pattern length.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT In the example shown in FIG. 1, fifteen adders are used to make parallel comparisons. The adders are des ignated A A A3, A etcetera, where the p and m indicate the plus and minus inputs of the adders. The words are designrietL as W W,, etcetera, and their complements are W,W,, etcetera. Initially all 16 words are compared in pairs in the first 8 adders (word I with word 2, word 3 with word 4, etcetera). The lowest word of each pair is fed to one of the next four adders. The lowest words from these comparisons are fed to two adders. Finally, two words are compared in the 15th adder yielding the minimum value of the 16 words. The logic which will be explained later excludes this minimum from further comparisons.

It is not necessary to repeat the first set of comparisons. The next iterations begin with an eight word input and I6 minimum value flip-flops record the lowest words. A minimum value flip-flop is set when the corresponding word is found to be the next lowest value. These flip-flops are clocked at the end of each iteration and the new minimum value causes a new set of inputs to be gated to the adders. A sort key flip-flops corresponding to the current lowest word are set to the current value of the counter so that at the end of 16 iterations the sort key flip-flops contain the rank for each word. The counter is used to control the number of iterations. If the fifth rank is desired, as shown, at the end of five iterations the minimum value flip-flops are cleared of their previous values and only the fifth rank flip-flop is set. A modulo 5 counter is used for the control.

The minimum value flip-flops, the sort key flip-flops, and the counter are all reset to zero initially.

For making the comparisons in the adders, the ones complement of every other word is gated to the adders. If the carry bit is a one, the second word is less than the first.

In FIG. 2a, 2b and 2c, the blocks A A represent the adders. The p and m sides of the adders correspond to the plus and minus sides of the adders and using the notation of FIG. I, A,= A, and A A,= A, and A etcetera. The lines W,, W,, on the left-hand side of FIGS. 2a and 2b represent the input words and correspond to the input words shown in FIG. I.

The notation used in the logic diagrams is as follows:

W, are the input words;

G G G, are stages of three bit counter II (modulo K to find the K" rank) appearing in FIG. 2d;

M, are the minimum value flip-flps (delay flip-flops), or the respective outputs thereof. At the end of one cycle of counter 11 the flip-flop which is set denotes the position of the K ranking value. The output of these flip-flops are the inputs shown in FIGS. 20 to 20;

Z 'ZHZ, shown in FIGS. 24 and 2e are stages of the sort key flip-flops 13. At the end of one set of comparisons flip-flops 13 contain the rank (in binary form) of the ith word.

The logic is for a 16 word input, but only an eight word input is shown. The logic for words nine to 16 is identical to that shown in FIGS. 2a to 2d up to and including logic block Y,. Logic block Y from the duplicated logic is fed to adder A, shown in FIG. 2c. An exact duplicate of the logic is required for words nine to 16.

The logic as shown in FIGS. 2a through 2d handles only one bit from each of the input words. If there are 8 bits per word, there will be eight times as many logic elements. For example, for 16 input words of 8 bits each there will be a total of l6 Y blocks (8Y, plus 8Y Each adder will handle two 8 bit words. The number of logic blocks does not depend on the number of bits, i.e., there will be a total of 16 minimum value flip-flops regardless of the number of bits per word.

The last set of gates and Z, delay flip-flops 13 appearing on the right side of dotted lines 14 and 16 shown in FIGS. 2e and 2d respectively are not necessary when the device is to be used to find one rank.

As shown in FIGS. 2a through 2c, it is seen that the first input word (W,) is fed to the plus half of the first adder (A,) and the ones complement of the second word (W goes to the minus half of the first adder. Then either W, or W is gated into the plus half of the ninth adder (A,,). On the first comparison, the lower of the two values is gated to A The choice will be determined by the value of the carry bit (C,) from the first adder. On succeeding comparisons, the choice ofW, or W will depend also on whether W, or W have already been identified as minimum values, i.e., the choice will depend on M, and M, as well as C,. For example, if W, is found to be the lowest value of the 16 words, then M, will be set to one and W, will be ignored on succeeding iterations. The gating involving M,, M and C, is performed in logic blocks P,, 0,, an R,.

A similar gating function is performed in logic blocks T and U. Logic blocks T,, T,, and U, control the input to the plus half of the thirteenth adder. The choice of W,, W,, W,, or W, as input to A depends on the value of the carry bit (C,,) from the ninth adder and on M,, M M and M Logic blocks V,, V,, and Y, control the input to the plus half of the fifteenth adder.

The logic used to set the minimum value flip-flops (M,, M,, M,,,) is shown in the first half of FIGS. 2e and 2d. The setting of a flip-flop depends on the carry bit (C, from the last adder and on the previous values of these flip-flops. If the first word has the lowest value 4 out of the 16 words, M, will be set to a one at the end of the first set of comparisons. Simultaneously the value of counter 11 (which equals zero for the first set of comparisons) is gated into the Z flip-flops (Z,,Z,'Z,). The counter is shown at the top of FIG. 2d and is increased by one at the end of each set of comparisons. Suppose that the fourth word is found to be the second from the lowest value. Then M, will be set to a one on the second iteration and the counter value (which will be equal to one) will be gated into the Z flip-flops.

Referring to FIG. 3 which shows the details of logic blocks P,, Q,, and R,, that were shown in FIG. 20, P, comprises AND gate 2i fed by C and M, and AND gate 23 fed by M, and M The output of gates 21 and 23 are then fed to OR gate 25. 0, comprises AND gate 27 fed by the negative of C, (due to Not Circuit 29) and M, and AND gate 3] fed by M, and M The outputs of AND gates 27 and 31 are then fed to OR gate 33. R, comprises AND gate 35 fed by I, and W, and AND gate 37 fed by Q, and W The output of the AND gates 35 and 37 are then fed to OR gate 39.

Referring to FIG. 4 which shows the details of logic blocks T,, T and U, that were shown in FIGS. 2a and 2c, T, comprises AND gate 41 fed by the negative of C (due to Not circuit 43) and M,, AND gate 45 fed by the negative of C and M and AND gate 47 fed by M, and M,. The outputs of AND gates 41, 45 and 47 are fed to OR gate 49 and then to Not circuit 51. T, comprises AND gate 53 fed by C, and M,, AND gate 55 fed by C and M and AND gate 57 fed by M, and M,. The outputs of AND gates 51, 53, and 55 are fed to OR gate 59 and then to Not circuit 61. U, comprises AND gate 63 fed by T, and R, and AND gate 65 fed by R and T The outputs of AND gates 63 and 65 are then fed to OR gate 67.

Referring to FIG. 5 which shows the details of logic blocks V,, V,, and Y, that were shown in FIG. 2c, V, comprises AND gate 71 fed by the negative ofC, (due to Not circuit 73) and M,, and gate 75 fed by the negative of C,,, and M and gate 77 fed by the negative of C,,, and M and AND gate 79 fed by the negative ofC and M,, and AND gate 71 fed by M M,,, M,, and M,,. The outputs of AND gates 71, 75, 77, 79, and 81 are fed to OR gate 83 and then to Not circuit 85. V comprises AND gate 87 fed by M,, M,, M and M,, AND gate 89 fed by M and C,,,, AND gate 91 fed by M, and C AND GATE 93 fed by H, and c and AND gate 95 fed by M and C The outputs of AND gates 87, 89, 9], 93 and 95 are fed to OR gate 97 and then to Not Circuit 99. Y, comprises AND gate 101 fed by V, and U, and AND gate 103 fed by U and V The output of AND gates 10] and 103 are then fed to OR gate 105.

The timing relationship of the sorter and ranker is shown in FIG. 6 where a typcial route is used as an example. This route starts at adder A, and terminates at Z flip-flop. The horizontal distance represents the comparative measure of time.

It is claimed:

1. A system for sorting and ranking a series of binary words comprising:

a. a first series of comparing adders, each adder fed by a sequential pair of words from the series of hinary words with one of each pair being a one's complement and having an output representing the lowest value thereof;

b. a first series of pairs of coincidence logic circuits,

each pair corresponding to one each of the first series of comparing adders fed by the output of the comparing adder;

c. a second series of coincidence logic circuits fed by one pair each of the first series of pairs of conici dence logic circuits and by the corresponding pais of binary words;

d. a second series of comparing adders, each adder fed by pairs of the second series of coincidence logic circuits;

e. a third series of pairs of coincidence logic circuits each pair enabled by one of the second series of comparing adders;

f. a fourth series of coincidence logic circuits fed by one each of the third series of coincidence logic circuits and sequential pairs of the second series of coincidence logic circuits;

g. a final comparing adder fed by the fourth series of coincidence logic circuits;

h. a series of minimum value gating circuits fed by the final comparing adder, the first series of pairs of co- 5 6 incidence logic circuits, and the third series of pairs 2. A system for sorting and ranking a series of binary of coincidence logic circuits; words according to claim 1 which further comprises;

'. a counter feeding the series of minimum value gata. a plurality of series of ranking flip-flops, each seing circuits; and ries corresponding to a binary word;

'. a series of minimum value flip-flops each corre- 5 b. aplurality of ranking gating circuits interposed besponding to one binary word and fed by one each tween the ranking flip-flop and the minimum value of the series of minimum value gating circuits, the gating coincidence logic circuits, and output of the minimum value flip-flops being fed to c. a binary counter feeding enabling pulses to the pluthe first and third series of coincidence logic cirrality of ranking gating circuits. cuits. I0 

1. A system for sorting and ranking a series of binary words comprising: a. a first series of comparing adders, each adder fed by a sequential pair of words from the series of binary words with one of each pair being a one''s complement and having an output representing the lowest value thereof; b. a first series of pairs of coincidence logic circuits, each pair corresponding to one each of the first series of comparing adders fed by the output of the comparing adder; c. a second series of coincidence logic circuits fed by one pair each of the first series of pairs of conicidence logic circuits and by the corresponding pais of binary words; d. a second series of comparinG adders, each adder fed by pairs of the second series of coincidence logic circuits; e. a third series of pairs of coincidence logic circuits each pair enabled by one of the second series of comparing adders; f. a fourth series of coincidence logic circuits fed by one each of the third series of coincidence logic circuits and sequential pairs of the second series of coincidence logic circuits; g. a final comparing adder fed by the fourth series of coincidence logic circuits; h. a series of minimum value gating circuits fed by the final comparing adder, the first series of pairs of coincidence logic circuits, and the third series of pairs of coincidence logic circuits; i. a counter feeding the series of minimum value gating circuits; and j. a series of minimum value flip-flops each corresponding to one binary word and fed by one each of the series of minimum value gating circuits, the output of the minimum value flipflops being fed to the first and third series of coincidence logic circuits.
 2. A system for sorting and ranking a series of binary words according to claim 1 which further comprises: a. a plurality of series of ranking flip-flops, each series corresponding to a binary word; b. a plurality of ranking gating circuits interposed between the ranking flip-flop and the minimum value gating coincidence logic circuits, and c. a binary counter feeding enabling pulses to the plurality of ranking gating circuits. 